{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-banner" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="icon-checkmark"></i></button>
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="icon-return"></i></a></div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %}
    <div class="alert alert-danger alert-dismissible"><i class="icon-warning"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="icon-pencil"></i> {{ text_form }}</h3>
      </div>
      <div class="panel-body">
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-banner" class="form-horizontal">
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-name">{{ entry_name }}</label>
            <div class="col-sm-10">
              <input type="text" name="name" value="{{ name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" />
              {% if error_name %}
              <div class="text-danger">{{ error_name }}</div>
              {% endif %}
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
            <div class="col-sm-10">
              <select name="status" id="input-status" class="form-control">
                {% if status %}
                <option value="1" selected="selected">{{ text_enabled }}</option>
                <option value="0">{{ text_disabled }}</option>
                {% else %}
                <option value="1">{{ text_enabled }}</option>
                <option value="0" selected="selected">{{ text_disabled }}</option>
                {% endif %}
              </select>
            </div>
          </div>
          <br />
          <ul class="nav nav-tabs{% if languages|length == 1 %} hidden{% endif %}" id="language">
            {% for language in languages %}
            <li{% if loop.index == 1 %} class="active"{% endif %}><a href="#language{{ language.language_id }}" data-toggle="tab"><img src="language/{{ language.code }}/icon.png" class="lang-icon" title="{{ language.name }}" /> {{ language.name }}</a></li>
            {% endfor %}
          </ul>
          <div class="tab-content">
            {% set image_row = 0 %}
            {% for language in languages %}
            <div class="tab-pane{% if loop.index == 1 %} active{% endif %}" id="language{{ language.language_id }}">
              <div class="table-responsive">
              <table id="images{{ language.language_id }}" class="table table-striped table-hover">
                <thead>
                  <tr>
                    <td class="text-left">{{ entry_title }}</td>
                    <td class="text-left">{{ entry_link }}</td>
                    <td class="text-left">{{ entry_subtitle }}</td>
                    <td class="text-left">{{ entry_text }}</td>
                    <td class="text-center">{{ entry_image }}</td>
                    <td class="text-right">{{ entry_sort_order }}</td>
                    <td></td>
                  </tr>
                </thead>
                <tbody>
                  {% if banner_images[language.language_id] %}
                  {% for banner_image in banner_images[language.language_id] %}
                  <tr id="image-row{{ image_row }}">
                    <td class="text-left"><input type="text" name="banner_image[{{ language.language_id }}][{{ image_row }}][title]" value="{{ banner_image.title }}" placeholder="{{ entry_title }}" class="form-control" />
                      {% if error_banner_image[language.language_id][image_row] %}
                      <div class="text-danger">{{ error_banner_image[language.language_id][image_row] }}</div>
                      {% endif %}</td>
                    <td class="text-left"><input type="text" name="banner_image[{{ language.language_id }}][{{ image_row }}][link]" value="{{ banner_image.link }}" placeholder="{{ entry_link }}" class="form-control" /></td>
                    <td class="text-left"><input type="text" name="banner_image[{{ language.language_id }}][{{ image_row }}][subtitle]" value="{{ banner_image.subtitle }}" placeholder="{{ entry_subtitle }}" class="form-control" /></td>
                    <td class="text-left"><textarea name="banner_image[{{ language.language_id }}][{{ image_row }}][text]" placeholder="{{ entry_text }}" class="form-control" rows="3">{{ banner_image.text }}</textarea></td>
                    <td class="text-center"><a href="" id="thumb-image{{ image_row }}" data-toggle="image" class="img-thumbnail"><img src="{{ banner_image.thumb }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a>
                      <input type="hidden" name="banner_image[{{ language.language_id }}][{{ image_row }}][image]" value="{{ banner_image.image }}" id="input-image{{ image_row }}" /></td>
                    <td class="text-left" style="width: 10%;"><input type="text" name="banner_image[{{ language.language_id }}][{{ image_row }}][sort_order]" value="{{ banner_image.sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td>
                    <td class="text-right"><button type="button" onclick="$('#image-row{{ image_row }}, .tooltip').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="icon-minus"></i></button></td>
                  </tr>
                  {% set image_row = image_row + 1 %}
                  {% endfor %}
                  {% endif %}
                </tbody>
                <tfoot>
                  <tr>
                    <td colspan="6"></td>
                    <td class="text-right"><button type="button" onclick="addImage('{{ language.language_id }}');" data-toggle="tooltip" title="{{ button_banner_add }}" class="btn btn-primary"><i class="icon-plus"></i></button></td>
                  </tr>
                </tfoot>
              </table>
              </div>
            </div>
            {% endfor %}
          </div>
        </form>
      </div>
    </div>
  </div>
  <script type="text/javascript"><!--
var image_row = {{ image_row }};

function addImage(language_id) {
	html  = '<tr id="image-row' + image_row + '">';
    html += '  <td class="text-left"><input type="text" name="banner_image[' + language_id + '][' + image_row + '][title]" value="" placeholder="{{ entry_title }}" class="form-control" /></td>';
	html += '  <td class="text-left"><input type="text" name="banner_image[' + language_id + '][' + image_row + '][link]" value="" placeholder="{{ entry_link }}" class="form-control" /></td>';
  html += '  <td class="text-left"><input type="text" name="banner_image[' + language_id + '][' + image_row + '][subtitle]" value="" placeholder="{{ entry_subtitle }}" class="form-control" /></td>';
  html += '  <td class="text-left"><textarea name="banner_image[' + language_id + '][' + image_row + '][text]" placeholder="{{ entry_text }}" class="form-control" rows="3"></textarea></td>';
	html += '  <td class="text-center"><a href="" id="thumb-image' + image_row + '" data-toggle="image" class="img-thumbnail"><img src="{{ placeholder }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a><input type="hidden" name="banner_image[' + language_id + '][' + image_row + '][image]" value="" id="input-image' + image_row + '" /></td>';
	html += '  <td class="text-right" style="width: 10%;"><input type="text" name="banner_image[' + language_id + '][' + image_row + '][sort_order]" value="" placeholder="{{ entry_sort_order }}" class="form-control" /></td>';
	html += '  <td class="text-right"><button type="button" onclick="$(\'#image-row' + image_row  + ', .tooltip\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="icon-minus"></i></button></td>';
	html += '</tr>';
	
	$('#images' + language_id + ' tbody').append(html);
	
	image_row++;
}
//--></script> 
  <script type="text/javascript"><!--
$('#language a:first').tab('show');
//--></script> 
</div>
{{ footer }} 